home *** CD-ROM | disk | FTP | other *** search
- package horst;
-
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Dimension;
- import java.awt.FontMetrics;
- import java.awt.Frame;
- import java.awt.Graphics;
- import java.awt.SystemColor;
- import java.awt.Window;
-
- class HTMLPane$ToolTip extends Window {
- // $FF: synthetic field
- private final HTMLPane this$0;
- String text;
-
- HTMLPane$ToolTip(HTMLPane this$0, String text) {
- super(new Frame());
- this.this$0 = this$0;
- this.this$0 = this$0;
- this.text = text;
- ((Component)this).setForeground(SystemColor.textText);
- ((Component)this).setBackground(Color.yellow);
- }
-
- public Dimension getPreferredSize() {
- Graphics g = ((Component)this).getGraphics();
- FontMetrics fm = g.getFontMetrics();
- return new Dimension(fm.stringWidth(this.text) + 4, fm.getHeight() + 4);
- }
-
- public void paint(Graphics g) {
- Dimension size = ((Component)this).getSize();
- FontMetrics fm = g.getFontMetrics();
- g.drawRect(0, 0, size.width - 1, size.height - 1);
- if (this.text.length() > 0) {
- g.drawString(this.text, 2, fm.getAscent() + 2);
- }
-
- }
-
- public void show() {
- ((Window)this).pack();
- super.show();
- }
- }
-